﻿package mortal.game.view.autoFight.render
{
    import com.mui.controls.*;
    import flash.events.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.view.autoFight.data.*;
    import mortal.game.view.common.*;
    import mortal.mvc.core.*;

    public class SelectBossRender extends GCellRenderer
    {
        private var _box:GCheckBox;
        private var _myData:SelectBossData;

        public function SelectBossRender()
        {
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            this._myData = param1 as SelectBossData;
            this._box.label = this._myData.boss.name;
            this._box.selected = this._myData.selected;
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._box = UIFactory.checkBox("", 0, 8, 120, 20, this);
            this._box.configEventListener(Event.CHANGE, this.selectedChangeHandler);
            return;
        }// end function

        private function selectedChangeHandler(event:Event) : void
        {
            this._myData.selected = this._box.selected;
            Dispatcher.dispatchEvent(new DataEvent(EventName.AutoFight_BossNotSelect, this._myData));
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._box.dispose(param1);
            this._box = null;
            return;
        }// end function

        override public function set label(param1:String) : void
        {
            return;
        }// end function

    }
}
